<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <table border="1">
      <caption>
        title
      </caption>
      <thead>
        <tr>
          <th>1,1</th>
          <th>1,2</th>
          <th>1,3</th>
          <th>1,4</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>2,1</td>
          <td>2,2</td>
          <td>2,3</td>
          <td>2,4</td>
        </tr>
      </tbody>
      <tbody>
        <tr>
          <td>2,1</td>
          <td>2,2</td>
          <td>2,3</td>
          <td>2,4</td>
        </tr>
      </tbody>
      <tbody>
        <tr>
          <td>2,1</td>
          <td>2,2</td>
          <td>2,3</td>
          <td>2,4</td>
        </tr>
      </tbody>
      <tfoot>
        <tr>
          <td>3,1</td>
          <td>3,2</td>
          <td>3,3</td>
          <td>3,4</td>
        </tr>
      </tfoot>
    </table>

    <script>
      const table = document.body.children[0];

      // 整张表的第n行单元格
      console.log(table.rows[0].cells);
      console.log(table.rows[1].cells);

      // tHead的第n行单元格
      console.log(table.tHead.rows[0].cells);
      // tFoot的第n行单元格
      console.log(table.tFoot.rows[0].cells);
      // tBodies[0]的第n行单元格
      console.log(table.tBodies[0].rows[0].cells);
      console.log(table.tBodies[1].rows[0].cells);
    </script>
  </body>
</html>
